<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('辅料出入库明细列表')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form class="form-horizontal m" th:object="${partIngredients}">
                    <input type="hidden" name="partId" id="partId" th:field="*{id}">
                    <div class="form-group">
                        <label class="col-sm-1 control-label">辅料名称：</label>
                        <div class="col-sm-3">
                            <input  th:field="*{name}" class="form-control" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">子名称：</label>
                        <div class="col-sm-3">
                            <input  th:field="*{subName}" class="form-control" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">库存数量：</label>
                        <div class="col-sm-3">
                            <input  th:field="*{inventory}" class="form-control" type="text">
                        </div>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <div class="col-sm-12 ">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <label style="width: 80px">操作时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="startTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
                            </li>
                            <li>
                                <label>出入库：</label>
                                <select name="type">
                                    <option value="">所有</option>
                                    <option value="1">出库</option>
                                    <option value="2">入库</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
                </div>
                <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:detail:add">-->
                    <!--<i class="fa fa-plus"></i> 添加-->
                <!--</a>-->
                <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:detail:edit">-->
                    <!--<i class="fa fa-edit"></i> 修改-->
                <!--</a>-->
                <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:detail:remove">-->
                    <!--<i class="fa fa-remove"></i> 删除-->
                <!--</a>-->
                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:detail:export">-->
                    <!--<i class="fa fa-download"></i> 导出-->
                <!--</a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:detail:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:detail:remove')}]];
        var prefix = ctx + "system/detail";

        $(function() {
            var options = {
                url: prefix + "/list?partId="+$("#partId").val(),
                queryParams: queryParams,
                // createUrl: prefix + "/add",
                // updateUrl: prefix + "/edit/{id}",
                // removeUrl: prefix + "/remove",
                // exportUrl: prefix + "/export",
                modalName: "辅料出入库明细",
                columns: [
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'partId',
                    title: '辅料id',
                    visible: false
                },
                {
                    field: 'changeValue',
                    title: '操作数量'
                },
                {
                    field: 'type',
                    title: '出入库状态',
                    formatter: function(value, row, index) {
                        return value == 1 ? "出库":"入库";
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'receiver',
                    title: '所属人员'
                },
                {
                    field: 'createTime',
                    title: '操作时间',
                    formatter:function (value, row, index) {
                		return value.substring(0,10);
                	}
                }
                // ,
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
                ]
            };
            $.table.init(options);
        });
        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.partId = $("#partId").val();
            return search;
        }
    </script>
</body>
</html>